<?php

/**
 * @author Nemo <nemo.xiaolan@gmail.com>
 */

need_login();

if(is_post()) {
    require PROJECT_DIR."/actions/blog/class.posts.php";
    $post = new Posts();
    $postid = $post->publish("text");
    /**
     * 保存TAG
     */
    if($_POST['post_tags']) {
        require PROJECT_DIR."/actions/blog/class.tags.php";
        $t = new Tags();
        $t->set_tag($postid, abs(intval($_POST["post_to"])), $_POST['post_tags'], "post");
    }
    
    r("blog/posts/".$postid);
}

$tpl->display("publish/text.tpl");